package com.atguigu.yygh.hosp.controller.admin;

import com.atguigu.yygh.common.result.R;
import com.atguigu.yygh.model.acl.User;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/admin/user")
// 解决跨域问题
//@CrossOrigin
public class UserController {
//    /admin/user/login
//    /admin/user/info
    @PostMapping("/login")
    public R login(@RequestBody User user){
        return R.ok().data("token","admin-token");
    }

//    如果形参的名字跟get请求的字符串一致的话,不用添加@RequestParam("token")注解
    @GetMapping("/info")
    public R info( String token){
        return R.ok()
                .data("roles","[admin]")
                .data("introduction","I am a super administrator")
                .data("avatar","https://tse3-mm.cn.bing.net/th/id/OIP-C.cPSquTypXVdOp_Dy_cFFjQHaO0?rs=1&pid=ImgDetMain")
                .data("name","Super Admin");
    }

}
